package com.sfpay.coreplatform.order.service.composite.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.sfpay.coreplatform.order.service.composite.IHandler;
import com.sfpay.coreplatform.order.service.composite.common.PayContext;
import com.sfpay.coreplatform.order.service.exception.OrderServiceException;
import com.sfpay.coreplatform.order.valueobject.dto.PayRequest;
import com.sfpay.coreplatform.order.valueobject.dto.Response;
@Service
public class TradePayStatusHandler implements IHandler {

	@Resource
	private TradeStatusHandler tradeStatusHandler;
	@Resource
	private PayStatusHandler payStatusHandler;
	
	@Transactional(rollbackFor={OrderServiceException.class},propagation=Propagation.NESTED)
	public Response Handler(PayRequest request, PayContext payContext)
			throws OrderServiceException {
		Response response=null;
		response=tradeStatusHandler.Handler(request, payContext);
		response=payStatusHandler.Handler(request, payContext);
		return response;
	}

	@Override
	public String getHandlerName() {
		 
		return "TradePayStatusHandler";
	}

}
